package cn.com.taurus.impl;
import cn.com.taurus.entity.ClientOptional;
import cn.com.taurus.entity.Fund;
import cn.com.taurus.mapper.ClientOptionalMapper;
import cn.com.taurus.service.ClientOptionalService;
import cn.com.taurus.service.ClientService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @remark 客户基金自选实现类
 * @author Zht
 * @createTime 2021年6月23日 15点43分
 * @version 1.0
 */
@Repository
public class ClientOptionalImpl implements ClientOptionalService {
    @Autowired
    ClientOptionalMapper clientOptionalMapper;


    public int insertClientOptional(ClientOptional clientOptional){
        return clientOptionalMapper.insertClientOptional(clientOptional);
    }

    /**
     * @remark 删除自选
     * @param cpId
     * @return
     */
    public int deleteClientOptional(int cpId){
        return clientOptionalMapper.deleteClientOptional(cpId);
    }

    @Override
    public int deleteClientOptionalByFId(@Param("fId") String fId, @Param("cId") Integer cId) {
        return clientOptionalMapper.deleteClientOptionalByFId(fId,cId);
    }



    /**
     * @remark 修改自选
     * @param clientOptional
     * @return
     */
    public int updateClientOptional(ClientOptional clientOptional){
        return clientOptionalMapper.updateClientOptional(clientOptional);
    }

    /**
     * @remark 查询全部自选
     * @return
     */
    public List<ClientOptional> selectClientOptional(){
        return clientOptionalMapper.selectClientOptional();
    }

    /**
     * @remark 条件查询
     * @param fId
     * @param cId
     * @return
     */
    public List<ClientOptional> selectConditionClientOptional(String fId, String cId){
        return clientOptionalMapper.selectConditionClientOptional(fId,cId);
    }

    /**
     * 根据cId查询自选的基金
     * @param cId cid
     * @return 自选基金集合
     */
    public List<Fund> selectClientOptionalFundByCId(Integer cId){
        return clientOptionalMapper.selectClientOptionalFundByCId(cId);
    }

    @Override
    public Integer selectCpId() {
        return clientOptionalMapper.selectCpId();
    }
}
